package org.smi.test2;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: ism
 * @Platform: Mac
 * @Date: 4:41 PM 2019/2/22
 */
public class Cld2 {

    public static void main(String[] args) {
        CountDownLatch countDownLatch = new CountDownLatch(3);
        ExecutorService fixedThreadPool = Executors.newFixedThreadPool(2);
        for(int i = 0; i < 3; i++) {
            Worker2 worker2 = new Worker2(i, countDownLatch);
            //worker2.start();
            fixedThreadPool.execute(worker2);
        }

        System.out.println("哈哈哈...");
        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("呵呵呵...");
        System.exit(0);
    }
}
